﻿class com.gamepackage.events.Call implements com.gamepackage.events.Executable
{
	private var obj: Object;
	private var func: Function;
	private var args: Array;

	function Call()
	{
		var a0 = arguments[ 0 ];
		var a1 = arguments[ 1 ];

		if ( a1 instanceof Function )
		{
			func = a1;
		}
		else
		{
			func = a0[ a1 ];
		}
		obj = a0;
		args = arguments.splice( 2 );
	}

	function execute(): Void
	{
		if ( arguments.length ) func.apply( obj , arguments )
			else func.apply( obj , args );
	}
}